<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery1.11.3.min.js"></script>
</head>
<script>
    $(function () {
        // alert("welcome jquery")
//给button加点击事件
        $("button").click(function () {
            alert(this);
        });

        //演示jquery对象是dom数组,并且得到它的长度
        alert($("div").length);

        //从控制台打印jquery对象作为数组,根据索引来取值
        console.log($("div")[0])

        console.info($(".arrow").text());

        //实现全选 取消
        $("#chkall").click(function () {
            var allcheck = this.checked;
            $("input[name='like']").each(function () {
                this.checked = allcheck;
            })
        })

    })
</script>
<body>
<button>check</button>
<div id="id1" style="background-color: antiquewhite"> this is div</div>
<div> this two div</div>
<div class="arrow"> this is arrow class</div>
<form action="/add" method="post">

    爱好 篮球<input type="checkbox" name="like" value="篮球">
    足球 <input type="checkbox" name="like" value="lanqiu">
    全选<input type="checkbox" id="chkall">
</form>
</body>
</html>